package com.anyou.mall.goo.service.impl;

import java.util.List;
import com.anyou.common.utils.DateUtils;
import com.anyou.mall.goo.domain.GoodsCoupon;
import com.anyou.mall.goo.domain.GoodsCouponRelation;
import com.anyou.mall.goo.mapper.GoodsCouponMapper;
import com.anyou.mall.goo.mapper.GoodsCouponRelationMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.anyou.mall.goo.mapper.GoodsCouponHistoryMapper;
import com.anyou.mall.goo.domain.GoodsCouponHistory;
import com.anyou.mall.goo.service.IGoodsCouponHistoryService;

/**
 * 优惠券历史记录Service业务层处理
 *
 * @author gaochaohao
 * @date 2022-04-11
 */
@Service
public class GoodsCouponHistoryServiceImpl extends ServiceImpl<GoodsCouponHistoryMapper, GoodsCouponHistory> implements IGoodsCouponHistoryService
{
    @Autowired
    private GoodsCouponHistoryMapper goodsCouponHistoryMapper;

    /**
     * 查询优惠券历史记录
     *
     * @param couponHistoryId 优惠券历史记录主键
     * @return 优惠券历史记录
     */
    @Override
    public GoodsCouponHistory selectGoodsCouponHistoryByCouponHistoryId(Long couponHistoryId)
    {
        return goodsCouponHistoryMapper.selectGoodsCouponHistoryByCouponHistoryId(couponHistoryId);
    }

    /**
     * 查询优惠券历史记录列表
     *
     * @param goodsCouponHistory 优惠券历史记录
     * @return 优惠券历史记录
     */
    @Override
    public List<GoodsCouponHistory> selectGoodsCouponHistoryList(GoodsCouponHistory goodsCouponHistory)
    {
        return goodsCouponHistoryMapper.selectGoodsCouponHistoryList(goodsCouponHistory);
    }

    /**
     * 新增优惠券历史记录
     *
     * @param goodsCouponHistory 优惠券历史记录
     * @return 结果
     */
    @Override
    public int insertGoodsCouponHistory(GoodsCouponHistory goodsCouponHistory)
    {
        goodsCouponHistory.setCreateTime(DateUtils.getNowDate());
        return goodsCouponHistoryMapper.insertGoodsCouponHistory(goodsCouponHistory);
    }

    /**
     * 修改优惠券历史记录
     *
     * @param goodsCouponHistory 优惠券历史记录
     * @return 结果
     */
    @Override
    public int updateGoodsCouponHistory(GoodsCouponHistory goodsCouponHistory)
    {
        goodsCouponHistory.setUpdateTime(DateUtils.getNowDate());
        return goodsCouponHistoryMapper.updateGoodsCouponHistory(goodsCouponHistory);
    }

    /**
     * 批量删除优惠券历史记录
     *
     * @param couponHistoryIds 需要删除的优惠券历史记录主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCouponHistoryByCouponHistoryIds(Long[] couponHistoryIds)
    {
        return goodsCouponHistoryMapper.deleteGoodsCouponHistoryByCouponHistoryIds(couponHistoryIds);
    }

    /**
     * 删除优惠券历史记录信息
     *
     * @param couponHistoryId 优惠券历史记录主键
     * @return 结果
     */
    @Override
    public int deleteGoodsCouponHistoryByCouponHistoryId(Long couponHistoryId)
    {
        return goodsCouponHistoryMapper.deleteGoodsCouponHistoryByCouponHistoryId(couponHistoryId);
    }
}
